package com.wc.alorithm_blue_bridge._动态规划.线性DP.青蛙吃虫;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/4/1 16:58
 * @description
 * https://www.lanqiao.cn/courses/46292/learning/?id=3455969&compatibility=false
 */
public class Main {
    /**
     * 思路:
     * 动态规划
     * f[i][j] 表示跳到 i 用了 j步 的得到的最大虫子数量
     * i == k 表示一步就能成
     * 是否能跳到得判断一下, i - k > 0, f[i - k][j - 1] > 0 || i - k == 0
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 110;
    static int[][] f = new int[N][N];
    static int[] a = new int[N];
    static int n, A, B, K;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            A = sc.nextInt();
            B = sc.nextInt();
            K = sc.nextInt();
            for (int i = 1; i <= n; i++) a[i] = sc.nextInt();

            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= K; j++) {
                    for (int k = A; k <= B; k++) {
                        // 判断是否能跳到, 如果是一步能跳到，i - k == 0, 但是前面也得能跳到才行
                        if (i - k > 0 && f[i - k][j - 1] > 0 || i - k == 0) f[i][j] = Math.max(f[i][j], f[i - k][j - 1] + a[i]);
                    }
                }
            }
            int res = 0;
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= K; j++) {
                    res = Math.max(res, f[i][j]);
                    f[i][j] = 0;
                }
            }
            out.println(res);

        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

